home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8970 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  35 lines

  1. Path: news.primenet.com!bjg
  2. From: Brad Grossman <bjg@primenet.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How can I include IOSTREAM.H only once?
  5. Date: 27 Feb 1996 02:25:01 -0700
  6. Organization: Primenet (602)395-1010
  7. Sender: root@primenet.com
  8. Message-ID: <4guild$r2i@nnrp1.news.primenet.com>
  9. References: <4gre90$oei@service.polymtl.ca>
  10. X-Posted-By: bjg@usr5.primenet.com
  11.  
  12. Michael Gaudette <bluefox@info.polymtl.ca> wrote:
  13. : I am presently engaged in what is usually called "the learning process", 
  14. : and I've been programming simple programs with classes.  Because of this, 
  15. : I have had to #include <iostream.h> in most of my "class.cpp" files AND 
  16. : in my main program. This (added to conio.h and all the other standard 
  17. : libraries) usually result in a simple program being 20000 lines long.
  18. : Is there any way (using Borland v4.5) to make the compiler only link 
  19. : those files ONCE?
  20.  
  21. : Thanks in advance for any help I may receive
  22.  
  23. I'm not all that experienced at C++ programming, but when looking through 
  24. the container classes that come with C++, I see the solution to your 
  25. problem.  Try this where you need IOSTREAM.H:
  26.  
  27. #if !defined ( __IOSTREAM_H )
  28. #include <iostream.h>
  29. #endif
  30.  
  31.  
  32. --
  33. Brad Grossman        "Energy derives from both the plus and negative"    
  34.                                    Metallica, Eye of the Beholder
  35.